home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / librw / RWTPtrMultiSetIterator.z / RWTPtrMultiSetIterator
Encoding:
Text File  |  2002-10-03  |  7.2 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTPtrMultiSetIterator<T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include<rw/tpmset.h>
  13.  
  14.  
  15.  
  16.               RWTPtrMultiSet<T,C> set;
  17.           RWTPtrMultiSetIterator<T,C> itr(set);
  18.  
  19. SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
  20.      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library.
  21.  
  22.  
  23. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  24.      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr is supplied with Tools 7 to provide an iterator
  25.      interface to the new Standard Library based collections that has backward
  26.      compatibility with the container iterators provided in Tools 6. The order
  27.      of iteration over an RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeetttt is dependent upon the comparator
  28.      object parameter CCCC as applied to the values stored in the container.  The
  29.      current item referenced by this iterator is undefined after construction
  30.      or after a call to rrrreeeesssseeeetttt(((()))).  The iterator becomes valid after being
  31.      advanced with either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))).  For both ooooppppeeeerrrraaaattttoooorrrr++++++++
  32.      and ooooppppeeeerrrraaaattttoooorrrr(((()))), iterating past the last element will return a value
  33.      equivalent to boolean ffffaaaallllsssseeee.  Continued increments will return a value
  34.      equivalent to ffffaaaallllsssseeee until rrrreeeesssseeeetttt(((()))) is called.
  35.  
  36. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  37.      None
  38.  
  39. EEEExxxxaaaammmmpppplllleeeessss
  40.               #include<rw/tpmset.h>
  41.  
  42.  
  43.  
  44.               #include<iostream.h>
  45.           #include<rw/cstring.h>
  46.  
  47.  
  48.               int main(){
  49.  
  50.  
  51.  
  52.                  RWTPtrMultiSet<RWCString, less<RWCString> > a;
  53.              RWTPtrMultiSetIterator<RWCString, less<RWCString> > itr(a);
  54.  
  55.  
  56.                  a.insert(new RWCString("John"));
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.                  a.insert(new RWCString("Steve"));
  75.              a.insert(new RWCString("Mark"));
  76.              a.insert(new RWCString("Steve"));
  77.  
  78.  
  79.                  for(;itr();)
  80.  
  81.  
  82.  
  83.                    cout << *itr.key() <<endl;
  84.  
  85.  
  86.  
  87.                  return 0;
  88.  
  89.  
  90.  
  91.               }
  92.           Program Output
  93.           John
  94.           Mark
  95.           Steve
  96.  
  97. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  98.      Steve
  99.  
  100.  
  101.  
  102.               RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr<<<<TTTT,,,,CCCC>>>>(const RWTPtrMultiSet<T,C>& m);
  103.  
  104.  
  105.      Creates an iterator for the multi-set mmmm.  The iterator begins in an
  106.      undefined state and must be advanced before the first element will be
  107.      accessible
  108.  
  109. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  110.               T*
  111.           ooooppppeeeerrrraaaattttoooorrrr(((())))();
  112.  
  113.  
  114.      Advances self to the next element, dereferences the resulting iterator
  115.      and returns its value.  If the iterator has advanced past the last item
  116.      in the container,  the element returned will be a nnnniiiillll pointer equivalent
  117.      to boolean ffffaaaallllsssseeee.
  118.  
  119.               RWBoolean
  120.           ooooppppeeeerrrraaaattttoooorrrr++++++++();
  121.  
  122.  
  123.      Advances self to the next element.  If the iterator has been reset or
  124.      just created self will now reference the first element.  If, before
  125.      iteration, self referenced the last association in the multi-set, self
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeettttIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.      will now point to an undefined value and a value equivalent to ffffaaaallllsssseeee will
  141.      be returned.  Otherwise, a value equivalent to ttttrrrruuuueeee is returned. Note: no
  142.      post-increment operator is provided.
  143.  
  144. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  145.               RWTPtrMultiSet<T,C>*
  146.           ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const;
  147.  
  148.  
  149.      Returns a pointer to the collection being iterated over.
  150.  
  151.               T*
  152.           kkkkeeeeyyyy();
  153.  
  154.  
  155.      Returns the stored value referenced by sssseeeellllffff.  Undefined if self is not
  156.      referencing a value within the list.
  157.  
  158.               void
  159.           rrrreeeesssseeeetttt();
  160.           void
  161.           rrrreeeesssseeeetttt(RWTPtrMultiSet<T,C>& h);
  162.  
  163.  
  164.      Resets the iterator so that after being advanced it will reference the
  165.      first element of the collection.  Using rrrreeeesssseeeetttt(((()))) with no argument will
  166.      reset the iterator on the current container.  Supplying a RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiSSSSeeeetttt
  167.      with rrrreeeesssseeeetttt(((()))) will reset the iterator on that container.
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.